package com.weiyu.bultrasound.core.model.common;

import org.springframework.util.StringUtils;

/**
 *@description 性别枚举
 *@author abner chow
 *@date 2019-08-09 11:46
 */
public enum GenderEnum {

    MAN("1", "男"),
    WOMAN("2", "女"),
    NOT_DESCRIBED("9", "未说明"),
    UNKONW("0", "未知"),
    ;

    protected String code;
    protected String desc;

    private GenderEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static String getByCode(String code) {
        String  desc = "";
        if (StringUtils.hasText(code)) {
            for (GenderEnum genderEnum : GenderEnum.values()) {
                if (genderEnum.getCode().equals(code)) {
                    desc = genderEnum.getDesc();
                }
            }
        }
        return desc;
    }

}
